package com.cj.designpattern.observer.Observer;

/**
 * ClassName: User <br/>
 * Function: 定义一个观察者 实现Observer<br/>
 * date: 2018/04/27 14:33 <br/>
 *
 * @author chenj
 * @version 1.0.0
 * @since JDK 1.8
 */
public class User implements Observer {

    private String name;
    private String message;

    public User(String name) {
        this.name = name;
    }

    @Override
    public void update(String message) {
        this.message = message;
        read();
    }

    public void read() {
        System.out.println(name + " 收到推送消息： " + message);
    }
}
